package com.source.lightfowl.utils;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * Created by 林子希
 * 2019-12-27 21:45
 */

@Data
public class MyResult {

    @ApiModelProperty(value="状态码",name="status",required=true)
    private int status;
    @ApiModelProperty(value="信息",name="msg",required=true)
    private String msg;
    @ApiModelProperty(value="对象",name="object",required=true)
    private Object object;

    public MyResult(){}

    public MyResult(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public MyResult(int status, String msg, Object object) {
        this.status = status;
        this.msg = msg;
        this.object = object;
    }

    public static MyResult ok(){
        return new MyResult(0,"成功");
    }

    public static MyResult ok(Object object) {
        return new MyResult(0,"成功",object);
    }

    public static MyResult no() {
        return new MyResult(1,"失败");
    }

    public static MyResult build(int status, String msg) {
        return new MyResult(status,msg);
    }

    public static MyResult build(int status, String msg, Object object) {
        return new MyResult(status,msg,object);
    }

}
